package previous.Test_0405;

import java.util.Scanner;

/**
 * Created with Intellij IDEA
 * Description:
 * User: 星辰
 */
public class Bridge_Blue {
    //团队赛
    public static void main1(String[] args) {
        Scanner scan = new Scanner(System.in);
        //在此输入您的代码...
        int a=scan.nextInt();
        int b=scan.nextInt();
        int c=scan.nextInt();
        if(a>b+c) {
            System.out.println("l");
            return;
        }else if(b>a+c) {
            System.out.println("q");
            return;
        }else if(c>a+c){
            System.out.println("b");
            return;
        }
        System.out.println(-1);
        scan.close();

    }
    //蓝桥速算
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        //在此输入您的代码...
        int n=scan.nextInt();
        int q=scan.nextInt();
        int[] a=new int[n+1];
        for(int i=1;i<=n;i++) {
            a[i]=scan.nextInt();
        }
        int[][] b=new int[q][2];
        for(int i=0;i<q;i++) {
            b[i][0]=scan.nextInt();
            b[i][1]=scan.nextInt();
        }
        long sum=0;
        for(int j=0;j<q;j++) {
            boolean check=false;
            for(int i=b[j][0];i<=b[j][1];i++) {
                if(check==false) {
                    a[i]+=i;
                    check=true;
                }else {
                    a[i]-=i;
                    check=false;
                }
            }
        }
        for(int x:a) {
            sum+=x;
        }
        System.out.println(sum);
        scan.close();
    }
}
